package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.Orders;
import com.sky.vo.OrderStatisticsVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.core.annotation.Order;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper {
    void insert(Orders orders);


    Page<Orders> pageQuery(OrdersPageQueryDTO ordersPageQueryDTO);

    @Select("select * from orders where id =#{id}")
    Orders details(Integer id);


    @Select("select count(id) from orders where  status=#{status}")
    Integer statistics(Integer status);

    void update(Orders orders);

    @Select("select * from orders where status = #{status} and order_time< #{order_time}")
    List<Orders> getByStatusandOrderTime(Integer status, LocalDateTime order_time);


    Integer countByMap(Map map);

    Double sumByMap(Map map);
}
